SUBROUTINE CALLPAR1S (CDCONF &
     & , KIDIA,KFDIA,KLON,KLEVS,KTILES,KVTYPES &
     & , KLEV   ,KSTART ,KSTEP  ,KTRAC   &
     & , KLEVI  ,KLEVO  ,KLEVSN          &                      !KPP
     & , KDHVTLS,KDHFTLS,KDHVTSS,KDHFTSS &
     & , KDHVTTS,KDHFTTS,KDHVTIS,KDHFTIS &
     & , KDHVSSS,KDHFSSS,KDHVIIS,KDHFIIS &
     & , KDHVWLS,KDHFWLS,KDHVRESS,KDHFRESS &
     & , KDHVCO2S,KDHFCO2S &
     & , KDHVBIOS,KDHFBIOS,KDHVBVOCS,KDHVVEGS,KDHFVEGS &
     & , PTSPHY &
!-----------------------------------------------------------------------
! - INPUT .
     & , PSSDP2, PSSDP3, PGEOM1 , PAPRS &
     & , PU     , PV     , PT     , PQ   , PC &
     & , PSNS &
     & , PASN ,   PRSN ,  PTSN, PWSN &
     & , PTSA   , PWL    , PTL    , PWSA &
     & , PTIA &
     & , PTLICE,PTLMNW,PTLWML,PTLBOT,PTLSF & !FLAKE
     & , PHLICE,PHLML,PLDEPTH,PCLAKE &       !FLAKE 
     & , PALBF & 
     & , PALUVP , PALUVD , PALNIP , PALNID &
     & , PALUVI , PALUVV , PALUVG &
     & , PALNII , PALNIV , PALNIG &
     & , PCVL   , PCVH   , PCUR    , PTVL   , PCO2TYP, PISOP_EP, PTVH   &
     & , PLAILC,  PLAIHC, PFWET, PAVGPAR, PRSML, PRSMH &
     & , PSOTY  , PSDOR   &
     & , PCI , PCIL, PSST , PGEMU, PLAT, PCFLX &
     & , PUSTRTI, PVSTRTI, PAHFSTI, PEVAPTI, PTSKTI &
     & , PANDAYVT,PANFMVT &
     & , PRESPBSTR,PRESPBSTR2,PBIOMASS_LAST,PBIOMASSTR_LAST,PBIOMASSTR2_LAST &   
     & , PBLOSSVT, PBGAINVT &
     & , PLSM &
     & , PZ0MCL , PMU0M &
     & , PZ0HCL &
     & , PZO     ,PHO     ,PHO_INV  ,PDO      ,POCDEPTH  &!KPP
     & , PADVT   ,PADVS   ,PTRI0    ,PTRI1    ,PSWDK_SAVE&!KPP
!     & , PUOC    ,PVOC    ,PUSTRC   ,PVSTRC              &!KPP
     & , PUO0    ,PVO0     ,PTO0     ,PSO0               &!KPP
! - INPUT AT T+1, AND/OR ATMOSPHERIC FORCING
     & , PU1    , PV1    , PT1    , PQ1 , PC1  &
     & , PSRSOD , PSRTHD &
     & , PFPLCL, PFPLCN  , PFPLSL , PFPLSN &
! - OUTPUT .
     & , PEVAPTIU & 
     &  ,PU10M  ,PV10M   ,PT2M    ,PD2M  &
     &  ,PQ2M   ,PMEAN   ,PGUST   ,PZIDLWV   ,PBLH  &
     & , PDIFTQ , PDIFTS &
     & , PFRSO &
     & , PFRTH &
     & , PSTRTU , PSTRTV &
     & , PAN, PAG, PRD, PRSOIL_STR, PRECO, PCO2FLUX, PCH4FLUX, PBVOCFLUX &
     & , PLAI,PLAILI,PLAIHI, PBIOM, PBLOSS, PBGAIN, PBIOMSTR, PBIOMSTR2 &
     & , PALB &
     & , PFTG12 , PFWEV  , PFWSB  , PFWG12 , PFWMLT , PZ0M  , PZ0H  &
     & , PFWROD , PFWRO1 , PFTLHEV, PFTLHSB &
     & , PVDIS &
     & , PDIFM    ,PDIFT   ,PDIFS, POTKE  &                      !KPP/TKE
     & , PSNSE1 , PASNE1 , PRSNE1 , PTSNE1, PWSNE1 &
     & , PTSAE1 &
     & , PWLE1  , PTLE1  , PWSAE1 &
     & , PTIAE1  &
     & , PTLICEE1,PTLMNWE1,PTLWMLE1 &         !FLAKE 
     & , PTLBOTE1,PTLSFE1,PHLICEE1,PHLMLE1 &  !FLAKE 
     & , PUOE1   ,PVOE1    ,PTOE1    ,PSOE1 &             !KPP
     & , PLAIE1, PBSTRE1, PBSTR2E1 &
     & , PDHTLS,PDHTSS,PDHTTS,PDHTIS,PDHIIS,PDHSSS,PDHWLS,PDHRESS,PDHCO2S,PDHBVOCS,PDHBIOS,PDHVEGS)

! (C) Copyright 1995- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
! In applying this licence, ECMWF does not waive the privileges and immunities
! granted to it by virtue of its status as an intergovernmental organisation
! nor does it submit to any jurisdiction.

!**** *CALLPAR1S * - CALL PHYSICS

!     PURPOSE.
!     --------
!     - CALL THE SUBROUTINES OF THE PHYSICS PACKAGE.

!**   Interface.
!     ----------
!        *CALL* *CALLPAR1S*

!-----------------------------------------------------------------------

! -   INPUT ARGUMENTS.
!     -------------------

! - DIMENSIONS ETC.

! KIDIA   : START OF HORIZONTAL LOOP
! KFDIA   : END OF HORIZONTAL LOOP
! KLON    : HORIZONTAL DIMENSION
! KTRAC   : NUMBER OF TRACERS
! KLEVS   : NUMBER OF LEVELS IN SOIL
! KTILES  : NUMBER OF vegetation (surface cover) tiles
! KVTYPES : NUMBER OF VEGETATION TYPES
! KLEV    : END OF VERTICAL LOOP AND VERTICAL DIMENSION
! KSTART  : FIRST STEP OF MODEL
! KSTEP   : CURRENT TIME STEP
!    *KLEVSN*       Number of snow layers (diagnostics) 
!    *KLEVI*        Number of sea ice layers (diagnostics)
!    *KDHVTLS*      Number of variables for individual tiles
!    *KDHFTLS*      Number of fluxes for individual tiles
!    *KDHVTSS*      Number of variables for snow energy budget
!    *KDHFTSS*      Number of fluxes for snow energy budget
!    *KDHVTTS*      Number of variables for soil energy budget
!    *KDHFTTS*      Number of fluxes for soil energy budget
!    *KDHVTIS*      Number of variables for sea ice energy budget
!    *KDHFTIS*      Number of fluxes for sea ice energy budget
!    *KDHVIIS*      Number of variables for interception water budget
!    *KDHFIIS*      Number of fluxes for interception water budget
!    *KDHVWLS*      Number of variables for soil water budget
!    *KDHFWLS*      Number of fluxes for soil water budget
!    *KDHVRESS*     Number of variables for resistances 
!    *KDHFRESS*     Number of fluxes for resistances

!    *KDHVCO2S*     Number of variables for CO2
!    *KDHFCO2S*     Number of fluxes for CO2
!    *KDHVBIOS*     Number of variables for biomass
!    *KDHFBIOS*     Number of fluxes for biomass
!    *KDHVBVOCS*    Number of variables for BVOC
!    *KDHVVEGS*     Number of variables for variables per vegetation type
!    *KDHFVEGS*     Number of fluxes for variables per vegetation type

! PTSPHY  : PHYSICS TIME STEP

! - 2D (0:KLEV) .

! PAPRS      : PRESSURE ON HALF-LEVELS.

! - 2D (1:KLEV) .

! PGEOM1     : GEOPOTENTIAL ON FULL LEVELS.
! PU         : X-COMPONENT OF WIND.
! PV         : Y-COMPONENT OF WIND.
! PT         : TEMPERATURE.
! PQ         : SPECIFIC HUMIDITY (WATER VAPOUR).

! - 1D (PROGNOSTIC QUANTITIES) .

! PSNS       : SNOW DEPTH (kg m-2)
! PASN       : Snow albedo (0-1)
! PRSN       : Snow density (kg m-3)
! PTSN       : Snow temperature (K)
! PTSA       : MULTI-LAYER SOIL TEMPERATURE
! PWSA       : MULTI-LAYER SOIL WETNESS
! PWL        : SKIN RESERVOIR WATER CONTENT (kg m-2)
! PTL        : SKIN TEMPERATURE
! PTIA       : MULTI-LAYER ICE TEMPERATURE

! - 1D (GEOGRAPHICAL DISTRIBUTION) .

! PALBF      : BACKGROUND SURFACE SHORTWAVE ALBEDO (SNOW-FREE).
! PALUVP     : MODIS ALBEDO UV-VIS PARALLEL (DIRECT) RADIATION
! PALUVD     : MODIS ALBEDO UV-VIS DIFFUSE RADIATION
! PALNIP     : MODIS ALBEDO NEAR IR PARALLEL (DIRECT) RADIATION
! PALNID     : MODIS ALBEDO NEAR IR DIFFUSE RADIATION
! PAL[UV|NI][I|V|G] : 6-component MODIS albedo coefficients
! PSDOR      : OROGRAPHIC STANDARD DEVIATION (M)
! PGEMU      : SIN of latitude
! PLSM       : LAND/SEA MASK.
! PZ0MCL     : ROUGHNESS LENGTH   (NB: Units   m)
! PMU0M      : LOCAL COSINE OF INSTANTANEOUS MEAN SOLAR ZENITH ANGLE.
! PZ0HCL     : ROUGHNESS LENGTH FOR HEAT   (NB: Units   m)
! PTVL       : LOW VEGETATION TYPE
! PCO2TYP   : TYPE OF PHOTOSYNTHESIS PATHWAY FOR LOW VEGETATION (C3/C4)
! PISOP_EP   : Isoprene emission potential
! PTVH       : HIGH VEGETATION TYPE

! PLAIH      : LEAF AREA INDEX HIGH
! PLAIL      : LEAF AREA INDEX LOW
! PRSMH      : STOMATAL RESISTANCE HIGH VEGETATION
! PRSML      : STOMATAL RESISTANCE LOW VEGETATION
! PANDAYVT   : DAILY NET CO2 ASSIM.OVER CANOPY PER VEGTYPE     KG_CO2/M2
! PANFMVT    : MAXIMUM LEAF ASSIMILATION PER VEGTYPE         KG_CO2/KG_AIR M/S  
! PRESPBSTR  : RESPIRATION OF ABOVE GROUND STRUCTURAL BIOMASS    KG_CO2/M2
! PRESPBSTR2 : RESPIRATION OF BELOW GROUND STRUCTURAL BIOMASS    KG_CO2/M2
! PBIOMASS_LAST: (ACTIVE) LEAF BIOMASS OF PREVIOUS DAY               KG/M2
!     NB: value only after nitro_decline, not after laigain!!!!
! PBIOMASSTR_LAST: ABOVE GROUND STRUCTURAL BIOMASS OF PREVIOUS DAY   KG/M2
! PBIOMASSTR2_LAST: BELOW GROUND STRUCTURAL BIOMASS OF PREVIOUS DAY  KG/M2
! PBLOSSVT   : ACTIVE BIOMASS LOSS                                   KG/M2
! PBGAINVT   : ACTIVE BIOMASS GAIN                                   KG/M2


! PSOTY      : SOIL TYPE
! PCVL       : LOW VEGETATION COVER
! PCVH       : HIGH VEGETATION COVER
! PCUR       : URBAN COVER (PASSIVE)
! PCFLX      : TRACER SURFACE FLUX
! PUSTRTI    : (INSTANTANEOUS) TILED SURFACE STRESS U-COMPONENT
! PVSTRTI    : (INSTANTANEOUS) TILED SURFACE STRESS V-COMPONENT
! PAHFSTI    : (INSTANTANEOUS) TILED SURFACE SENSIBLE HEAT FLUX
! PEVAPTI    : (INSTANTANEOUS) TILED EVAPORATION
! PTSKTI     : TILED SKIN TEMPERATURE
! PSLRFLTI    : Tile net longwave (not I/O of callpar1s)

! - 2D (1:KLEV) AT T+1 .

! PT1        : TEMPERATURE AT T+1
! PQ1        : HUMIDITY AT T+1
! PU1        : U-COMP. AT T+1
! PV1        : V-COMP. AT T+1

! - 1D (SURFACE 1D FORCING) .

! PSRSOD     : SURFACE SHORTWAVE RADIATIVE FLUX DOWNWARDS.
! PSRTHD     : SURFACE LONGWAVE RADIATIVE FLUX DOWNWARDS.
! PFPLCL     : CONVECTIVE PRECIPITATION AS RAIN.
! PFPLCN     : CONVECTIVE PRECIPITATION AS SNOW.
! PFPLSL     : STRATIFORM PRECIPITATION AS RAIN.
! PFPLSN     : STRATIFORM PRECIPITATION AS SNOW.
!-----------------------------------------------------------------------

! -   OUTPUT ARGUMENTS.
!     --------------------

! - 2D (0:KLEV) FLUXES .

! PDIFTQ     : TURBULENT FLUX (INC. Q NEGATIVE) OF SPECIFIC HUMIDITY.
! PDIFTS     : TURBULENT FLUX OF HEAT.
! PFRSO      : SHORTWAVE RADIATIVE FLUX.
! PFRTH      : LONGWAVE RADIATIVE FLUX.
! PSTRTU     : TURBULENT FLUX OF MOMENTUM "U".
! PSTRTV     : TURBULENT FLUX OF MOMENTUM "V".

! PAN        : NET CO2 ASSIMILATION OVER CANOPY.          
! PAG        : GROSS CO2 ASSIMILATION OVER CANOPY.       
! PRD        : DARK RESPIRATION.                         
! PRSOIL_STR : RESPIRATION FROM SOIL AND STRUCTURAL BIOMASS.
! PRECO      : ECOSYSTEM RESPIRATION.                   
! PCO2FLUX   : CO2 FLUX.
! PCH4FLUX   : CH4 FLUX.
! PBVOCFLUX  : Biogenic VOC FLUX.

! - 1D (TENDENCIES FROM SURFACE SCHEME)

! PSNSE1     : OF SNOW MASS PER UNIT SURFACE
! PASNE1     : of snow albedo
! PRSNE1     : of snow density
! PTSNE1     : of snow temperature
! PWLE1      : OF SKIN RESERVOIR WATER CONTENT
! PTLE1      : OF SKIN TEMPERATURE
! PTSAE1     : OF MULTI-LAYER SOIL TEMPERATURE
! PWSAE1     : OF MULTI-LAYER SOIL WETNESS
! PTIAE1     : OF MULTI-LAYER ICE TEMPERATURE

! PLAIE1     : OF LAI PER VEGETATION TYPE
! PBSTRE1    : OF ABOVE GROUND STRUCTURAL BIOMASS PER VEGETATION TYPE 
! PBSTR2E1   : OF BELOW GROUND STRUCTURAL BIOMASS PER VEGETATION TYPE 


! - 1D (DIAGNOSTIC) .

! PLAI       : LAI (M2/M2)
! PBIOM      : BIOMASS (KG/M2)
! PBLOSS     : BIOMASS LOSS (KG/M2)
! PBGAIN     : BIOMASS GAIN (KG/M2)
! PBIOMSTR   : ABOVE GROUND STRUCTURAL BIOMASS (KG/M2)
! PBIOMSTR2  : BELOW GROUND STRUCTURAL BIOMASS (KG/M2)


! PALB       : MODEL SURFACE SHORTWAVE ALBEDO.
! PFTLHEV    : SURFACE LATENT HEAT FLUX (SNOW FREE FRACTION)
! PFTLHSB    : SURFACE LATENT HEAT FLUX (SNOW COVERED FRACTION)
! PFTG12     : HEAT FLUX FROM LAYER 1 TO 2
! PFWEV      : SURFACE WATER VAPOUR FLUX (EVAPORATION)
! PFWSB      : SURFACE WATER VAPOUR FLUX (SUBLIMATION)
! PFWG12     : WATER FLUX FROM LAYER 1 TO 2
! PFWMLT     : WATER FLUX CORRESPONDING TO SURFACE SNOW MELT.
! PZ0M       : ROUGHNESS LENGTH (CURRENT)    (NB: Units   m)
! PZ0H       : ROUGHNESS LENGTH FOR HEAT (CURRENT)   (NB: Units   m)
! PFWROD     : RUN-OFF FLUX AT DEEPER LAYERS (2-4)
! PFWRO1     : RUN-OFF FLUX AT LAYER 1
! PVDIS      : TURBULENT DISSIPATION
!    *PU10M*        U-COMPONENT WIND AT 10 M                      M/S
!    *PV10M*        V-COMPONENT WIND AT 10 M                      M/S
!    *PT2M*         TEMPERATURE AT 2M                                K
!    *PD2M*         DEW POINT TEMPERATURE AT 2M                      K
!    *PQ2M*         SPECIFIC HUMIDITY AT 2M                       KG/KG
!    *PMEAN*        AREA AVERAGED WIND SP. AT 10 M INT. FROM KLEV   M/S
!    *PGUST*        GUST AT 10 M                                    M/S
!    *PZIDLWV*      Zi/L used for gustiness in wave model           m/m
!                   (NOTE: Positive values of Zi/L are set to ZERO)
!    *PBLH*         BOUNDARY LAYER HEIGHT                            M
!    *PDHTLS*       Diagnostic array for tiles (see module yomcdh)
!    *PDHTTS*       Diagnostic array for soil T (see module yomcdh)
!                      (Wm-2 for fluxes)
!    *PDHTIS*       Diagnostic array for ice T (see module yomcdh)
!                      (Wm-2 for fluxes)
!    *PDHTSS*     Diagnostic array for snow T (see module yomcdh)
!                      (Wm-2 for fluxes)
!    *PDHSSS*     Diagnostic array for snow mass (see module yomcdh)
!                      (m/s for fluxes)
!    *PDHIIS*     Diagnostic array for interception layer (see module yomcdh)
!    *PDHWLS*     Diagnostic array for soil water (see module yomcdh)
!    *PDHRESS*      Diagnostic array for resistances (see module yomcdh) 

!    *PDHCO2S*    Diagnostic array for CO2 (see module yomcdh)
!    *PDHBIOS*    Diagnostic array for biomass (see module yomcdh)
!    *PDHBVOCS*   Diagnostic array for BVOC emissions (see module yomcdh)
!    *PDHVEGS*    Diagnostic array for variables per vegetation type
!                (see module yomcdh)


!-----------------------------------------------------------------------

!     Externals.  RADSRF -
!     ---------   VDFMAIN1S-
!                 SRFMAIN-

!     Method. See documentaion.
!     -------
!     Modifications.
!     --------------
!     ORIGINAL 95-03-08 Pedro VITERBO
!            2008-01-22 Victor STEPANENKO
!     Components of wind stress (PUSTRTI AND PVSTRTI)
!     and sea surface temperature (PSST) are added to the arguments of subroutine SURFTSTP  
!     S. Boussetta/G.Balsamo May 2010 Add CTESSEL based on: 
!     Marita Voogt (KNMI) CTESSEL
!     Sebastien simplified CTESSEL
!     E. Dutra      29/05/2014      net longwave tiled
!     R. Hogan      15/01/2019      6-component MODIS albedo coefficients

!-----------------------------------------------------------------------
!     ******************************************************************
!     ****** IDIOSYNCRASIES *** IDIOSYNCRASIES *** IDIOSYNCRASIES ******
!     ******************************************************************
!     ***  MOREOVER, WATER IN DEEPER LAYERS HAS TO BE NORMALIZED TO  ***
!     ***  THE FIRST LAYER DEPTH. THIS IS EQUIVALENT TO A CHANGE OF  ***
!     ***  UNITS FROM PURE VOLUMETRIC UNITS (M3/M3, USED ELSEWHERE   ***
!     ***  IN THE CODE) TO MODIFIED VOLUMETRIC UNITS, NORMALIZED BY  ***
!     ***  THE DEPTH OF THE FIRST LAYER (M/0.07M, USED IN THE        ***
!     ***  PHYSICS)                                                  ***
!     ******************************************************************
!     ******************************************************************


USE YOMLUN1S , ONLY : NULOUT
USE YOMGF1S  , ONLY : RALT     ,RZUV
USE YOMGC1S  , ONLY : GELAT, GELAM

USE YOMCST   , ONLY : RSIGMA   ,RDAY
USE YOERAD   , ONLY : NSW      ,NTSW, NLWEMISS
USE YOERDI1S , ONLY : REMISS
USE YOMRIP   , ONLY : RSTATI   ,NSSSSS
USE YOEPHY   , ONLY : LERADS, LESICE, LESURF, LEVDIF, LECTESSEL, LEINTWIND, LEWARMSTART, LESNML,LESNICE, NALBEDOSCHEME, NCWS, LBVOC_EMIS
USE YOETHF   , ONLY : RHOH2O
USE YOMLOG1S , ONLY : LSEMISS
USE YOMGDI1S , ONLY : D1SRFLD  ,D1SRFLU  ,D1TRFLD  ,D1TRFLU &
     &             , D1SALB, D1SWDS  ,D1SSDS   ,D1SWLDS

USE YOMDPHY  ,ONLY : YDSURF
USE PARKIND1 ,ONLY : JPIM     ,JPRB, JPRD, JPIB
USE YOMHOOK  ,ONLY : LHOOK    ,DR_HOOK, JPHOOK
USE MPL_MODULE

IMPLICIT NONE

!*
!     ------------------------------------------------------------------
CHARACTER*1,INTENT(IN) :: CDCONF

INTEGER(KIND=JPIM),INTENT(IN) :: KIDIA,KFDIA,KLON,KLEVS,KTILES &
     & , KLEV   , KSTART , KSTEP ,KTRAC &
     & , KLEVSN ,KLEVI  ,KDHVTLS,KDHFTLS,KDHVTSS,KDHFTSS &
     & , KDHVTTS,KDHFTTS,KDHVTIS,KDHFTIS &
     & , KDHVSSS,KDHFSSS, KDHVIIS,KDHFIIS &
     & , KDHVWLS ,KDHFWLS ,KDHVRESS,KDHFRESS &
     & , KLEVO  !KPP 

INTEGER(KIND=JPIM),INTENT(IN)    :: KVTYPES
INTEGER(KIND=JPIM),INTENT(IN)    :: KDHVCO2S 
INTEGER(KIND=JPIM),INTENT(IN)    :: KDHFCO2S 
INTEGER(KIND=JPIM),INTENT(IN)    :: KDHVBIOS 
INTEGER(KIND=JPIM),INTENT(IN)    :: KDHFBIOS
INTEGER(KIND=JPIM),INTENT(IN)    :: KDHVBVOCS 
INTEGER(KIND=JPIM),INTENT(IN)    :: KDHVVEGS 
INTEGER(KIND=JPIM),INTENT(IN)    :: KDHFVEGS

REAL(KIND=JPRB),INTENT(IN)       :: PSSDP2(:,:)
REAL(KIND=JPRB),INTENT(IN)       :: PSSDP3(:,:,:)

REAL(KIND=JPRB) :: PGEOM1(KLON,KLEV),PAPRS(KLON,0:KLEV)
REAL(KIND=JPRB) :: PU(KLON,KLEV), PV(KLON,KLEV), &
     &     PT(KLON,KLEV), PQ(KLON,KLEV), PC(KLON,KLEV,KTRAC)
REAL(KIND=JPRB) :: PT1(KLON,KLEV), PU1(KLON,KLEV), PV1(KLON,KLEV), &
     &     PQ1(KLON,KLEV), PC1(KLON,KLEV,KTRAC)
REAL(KIND=JPRB) :: PCFLX(KLON,KTRAC)

REAL(KIND=JPRB) :: PSRSOD(KLON), PSRTHD(KLON)
REAL(KIND=JPRB) :: PFPLCL(KLON), PFPLCN(KLON), PFPLSL(KLON), PFPLSN(KLON)
REAL(KIND=JPRB) :: PU10M(KLON),PV10M(KLON),PT2M(KLON),PD2M(KLON),&
     &    PQ2M(KLON),PMEAN(KLON),PGUST(KLON),PZIDLWV(KLON),PBLH(KLON)

REAL(KIND=JPRB) :: PSNS(KLON,KLEVSN),PASN(KLON),PRSN(KLON,KLEVSN),PTSN(KLON,KLEVSN),PWSN(KLON,KLEVSN)
REAL(KIND=JPRB) :: PWL(KLON),PTL(KLON)
REAL(KIND=JPRB) :: PTSA(KLON,KLEVS)  ,PWSA(KLON,KLEVS)
REAL(KIND=JPRB) :: PTIA(KLON,KLEVS)
REAL(KIND=JPRB) :: PGEMU(KLON), PLAT(KLON)
REAL(KIND=JPRB) :: PALBF(KLON), &
     &     PLSM(KLON), &
     &     PMU0M(KLON), &
     &     PZ0MCL(KLON), &
     &     PZ0HCL(KLON)
REAL(KIND=JPRB) :: PALUVP(KLON), PALUVD(KLON), PALNIP(KLON), PALNID(KLON)
REAL(KIND=JPRB) :: PALUVI(KLON), PALUVV(KLON), PALUVG(KLON)
REAL(KIND=JPRB) :: PALNII(KLON), PALNIV(KLON), PALNIG(KLON)
REAL(KIND=JPRB) :: PTVL(KLON)  ,PCO2TYP(KLON), PISOP_EP(KLON), PTVH(KLON)  ,PCVL(KLON)  ,PCVH(KLON) ,PCUR(KLON)
REAL(KIND=JPRB) :: PLAILC(KLON),PLAIHC(KLON)
REAL(KIND=JPRB) :: PSOTY(KLON) ,PSDOR(KLON)
REAL(KIND=JPRB) :: PCI(KLON)   , PCIL(KLON), PSST(KLON)
REAL(KIND=JPRB) :: PUSTRTI(KLON,KTILES),PVSTRTI(KLON,KTILES), &
     &     PAHFSTI(KLON,KTILES),PEVAPTI(KLON,KTILES), &
     &     PTSKTI(KLON,KTILES),PSLRFLTI(KLON,KTILES),PEVAPTIU(KLON,KTILES)
REAL(KIND=JPRB) :: PUSTOKES(KLON),PVSTOKES(KLON),PTAUOCX(KLON),PTAUOCY(KLON), &
     &     PPHIOC(KLON),PWSEMEAN(KLON),PWSFMEAN(KLON) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PFWET(KLON)                                    !CTESSEL
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAVGPAR(KLON)                                  !CTESSEL
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRSML(KLON)                                    !CTESSEL
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRSMH(KLON)                                    !CTESSEL 
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PANDAYVT(KLON,KVTYPES)                          !CTESSEL
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PANFMVT(KLON,KVTYPES)                            !CTESSEL
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PRESPBSTR(KLON,KVTYPES)                          !CTESSEL
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PRESPBSTR2(KLON,KVTYPES)                         !CTESSEL
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PBIOMASS_LAST(KLON,KVTYPES)                      !CTESSEL
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PBIOMASSTR_LAST(KLON,KVTYPES)                     !CTESSEL
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PBIOMASSTR2_LAST(KLON,KVTYPES)                   !CTESSEL 
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PBLOSSVT(KLON,KVTYPES)                           !CTESSEL
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PBGAINVT(KLON,KVTYPES)                           !CTESSEL

REAL(KIND=JPRB) ,INTENT(INOUT)   :: PLAILI(KLON)                                     !CTESSEL
REAL(KIND=JPRB) ,INTENT(INOUT)   :: PLAIHI(KLON)                                     !CTESSEL

REAL(KIND=JPRB)   ,INTENT(OUT)   ::PAN(KLON)                                          !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PAG(KLON)                                        !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PRD(KLON)                                        !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PRSOIL_STR(KLON)                                 !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PRECO(KLON)                                      !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PCO2FLUX(KLON)                                    !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PCH4FLUX(KLON)                                    !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PBVOCFLUX(KLON,KDHVBVOCS)                        !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PLAI(KLON)                                       !CTESSEL

REAL(KIND=JPRB)   ,INTENT(OUT)   ::PBIOM(KLON)                                       !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PBLOSS(KLON)                                      !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PBGAIN(KLON)                                      !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PBIOMSTR(KLON)                                    !CTESSEL
REAL(KIND=JPRB)   ,INTENT(OUT)   ::PBIOMSTR2(KLON)                                    !CTESSEL
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PLAIE1(KLON,KVTYPES)                               !CTESSEL
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PBSTRE1(KLON,KLEVS)                                !CTESSEL
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PBSTR2E1(KLON,KVTYPES)                             !CTESSEL
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDHBIOS(KLON,KVTYPES,KDHVBIOS+KDHFBIOS)             !CTESSEL
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDHCO2S(KLON,KVTYPES,KDHVCO2S+KDHFCO2S)              !CTESSEL
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDHVEGS(KLON,KVTYPES,KDHVVEGS+KDHFVEGS)             !CTESSEL
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDHBVOCS(KLON,KVTYPES,KDHVBVOCS)                  !CTESSEL


REAL(KIND=JPRB)                  :: ZPAPSRF(KLON)                                    ! SURFACE PRESSURE
REAL(KIND=JPRB) :: PDIFTQ(KLON,0:KLEV),PDIFTS(KLON,0:KLEV),&
     &     PFRSO(KLON,0:KLEV) ,PFRTH(KLON,0:KLEV), &
     &     PSTRTU(KLON,0:KLEV),PSTRTV(KLON,0:KLEV)

REAL(KIND=JPRB) :: PALB(KLON)
REAL(KIND=JPRB) :: PFTG12(KLON),PFTLHEV(KLON),PFTLHSB(KLON),&
     &     PFWEV(KLON) , &
     &     PFWG12(KLON),PFWMLT(KLON),PZ0M(KLON),PFWSB(KLON), &
     &     PFWROD(KLON),PFWRO1(KLON),PZ0H(KLON),ZUCURR(KLON),ZVCURR(KLON)

REAL(KIND=JPRB) :: PSNSE1(KLON,KLEVSN),PASNE1(KLON),PRSNE1(KLON,KLEVSN),PTSNE1(KLON,KLEVSN),PWSNE1(KLON,KLEVSN)
REAL(KIND=JPRB) :: PWLE1(KLON),PTLE1(KLON)
REAL(KIND=JPRB) :: PTSAE1(KLON,KLEVS),PWSAE1(KLON,KLEVS)
REAL(KIND=JPRB) :: PTIAE1(KLON,KLEVS)

REAL(KIND=JPRB) :: PVDIS (KLON)

REAL(KIND=JPRB) :: PDHTLS(KLON,KTILES,KDHVTLS+KDHFTLS) 
REAL(KIND=JPRB) :: PDHTSS(KLON,KLEVSN,KDHVTSS+KDHFTSS) 
REAL(KIND=JPRB) :: PDHTTS(KLON,KLEVS,KDHVTTS+KDHFTTS) 
REAL(KIND=JPRB) :: PDHTIS(KLON,KLEVI,KDHVTIS+KDHFTIS) 
REAL(KIND=JPRB) :: PDHIIS(KLON,KDHVIIS+KDHFIIS) 
REAL(KIND=JPRB) :: PDHWLS(KLON,KLEVS,KDHVWLS+KDHFWLS) 
REAL(KIND=JPRB) :: PDHSSS(KLON,KLEVSN,KDHVSSS+KDHFSSS) 
REAL(KIND=JPRB) :: PDHRESS(KLON,2,KDHVRESS+KDHFRESS) 

REAL(KIND=JPRB) :: PTSPHY

REAL(KIND=JPRB) :: PTLICE(KLON),PTLMNW(KLON),PTLWML(KLON), &                 !FLAKE
                  &PTLBOT(KLON),PTLSF(KLON),PHLICE(KLON),PHLML(KLON)         !FLAKE
REAL(KIND=JPRB) :: PTLICEE1(KLON),PTLMNWE1(KLON),PTLWMLE1(KLON), &           !FLAKE
                  &PTLBOTE1(KLON),PTLSFE1(KLON),PHLICEE1(KLON),PHLMLE1(KLON) !FLAKE
REAL(KIND=JPRB) :: PLDEPTH(KLON)                                             !FLAKE
REAL(KIND=JPRB) :: PCLAKE(KLON) 
                                             !FLAKE 
! KPP: Ocean model prognostic (Local for PASSIVE introduction)
REAL(KIND=JPRB) :: PZO(KLON,KLEVO+1)             !KPP
REAL(KIND=JPRB) :: PHO(KLON,KLEVO+1)             !KPP
REAL(KIND=JPRB) :: PHO_INV(KLON,KLEVO+1)         !KPP
REAL(KIND=JPRB) :: PDO(KLON,0:KLEVO)             !KPP
REAL(KIND=JPRB) :: POCDEPTH(KLON)                !KPP
REAL(KIND=JPRB) :: PADVT(KLON,KLEVO+1)           !KPP
REAL(KIND=JPRB) :: PADVS(KLON,KLEVO+1)           !KPP
REAL(KIND=JPRB) :: PTRI0(KLON,0:KLEVO)           !KPP
REAL(KIND=JPRB) :: PTRI1(KLON,0:KLEVO)           !KPP
REAL(KIND=JPRB) :: PSWDK_SAVE(KLON,0:KLEVO)      !KPP
REAL(KIND=JPRB) :: PUO0(KLON,KLEVO+1)            !KPP
REAL(KIND=JPRB) :: PVO0(KLON,KLEVO+1)            !KPP
REAL(KIND=JPRB) :: PTO0(KLON,KLEVO+1)            !KPP
REAL(KIND=JPRB) :: PSO0(KLON,KLEVO+1)            !KPP
REAL(KIND=JPRB) :: PUOE1(KLON,KLEVO+1)           !KPP
REAL(KIND=JPRB) :: PVOE1(KLON,KLEVO+1)           !KPP
REAL(KIND=JPRB) :: PTOE1(KLON,KLEVO+1)           !KPP
REAL(KIND=JPRB) :: PSOE1(KLON,KLEVO+1)           !KPP
REAL(KIND=JPRB) :: PUOC(KLON,KLEVO+1)            !KPP
REAL(KIND=JPRB) :: PVOC(KLON,KLEVO+1)            !KPP
REAL(KIND=JPRB) :: PUSTRC(KLON)                  !KPP
REAL(KIND=JPRB) :: PVSTRC(KLON)                  !KPP
REAL(KIND=JPRB) :: PDIFM(KLON,0:KLEVO)           !KPP
REAL(KIND=JPRB) :: PDIFT(KLON,0:KLEVO)           !KPP
REAL(KIND=JPRB) :: PDIFS(KLON,0:KLEVO)           !KPP
REAL(KIND=JPRB) :: POTKE(KLON,0:KLEVO)           !TKE

!            0.2  LOCAL VARIABLES
!                 ---------------

LOGICAL LLLAND(KLON),LLSICE(KLON),LLNH(KLON), LLLICE(KLON)
LOGICAL LLLAKE(KLON)  !FLAKE
LOGICAL LLOCN_KPP(KLON) !KPP 

REAL(KIND=JPRB) :: ZEMIS(KLON)
REAL(KIND=JPRB) :: ZALBD(KLON,NTSW), ZALBP(KLON,NTSW)
REAL(KIND=JPRB) :: ZWND(KLON)
REAL(KIND=JPRB) :: ZWLMX (KLON),ZEMIR(KLON),ZEMIW(KLON)
REAL(KIND=JPRB) :: ZCHAR(KLON)
REAL(KIND=JPRB) :: ZCHARHQ(KLON)
REAL(KIND=JPRB) :: ZCVL(KLON),ZCVH(KLON),ZCUR(KLON)
REAL(KIND=JPRB) :: ZLAIL(KLON),ZLAIH(KLON)
REAL(KIND=JPRB) :: ZLAILP(KLON),ZLAIHP(KLON),ZAVGPAR(KLON)
REAL(KIND=JPRB) :: ZAVGPARC(KLON) ! Should be transformed into an input parameter!
REAL(KIND=JPRB) :: ZEVAPSNW(KLON)
REAL(KIND=JPRB) :: ZFRTI(KLON,KTILES),zalbti(klon,ktiles),ZFRSOTI(KLON,KTILES)
REAL(KIND=JPRB) :: ZCSN(KLON)
REAL(KIND=JPRB) :: ZFAC
REAL(KIND=JPRD) :: ZJUL ! needed jprd for dattim
REAL(KIND=JPRB) :: ZCCNL(KLON),ZCCNO(KLON) ! CCN concentrations over land/ocean

REAL(KIND=JPRB) :: ZTE(KLON,KLEV),ZQE(KLON,KLEV)
REAL(KIND=JPRB) :: ZVOM(KLON,KLEV),ZVOL(KLON,KLEV)
REAL(KIND=JPRB) :: ZTENC(KLON,KLEV,KTRAC)
REAL(KIND=JPRB) :: ZKH(KLON,KLEV)          ! turb.diffusivity
REAL(KIND=JPRB) :: ZENES(KLON,KLEVS)       ! energy per unit surface
REAL(KIND=JPRB) :: ZWS1(KLON),ZFRTH(KLON)

INTEGER(KIND=JPIM) :: ITVL(KLON),ICO2TYP(KLON), ITVH(KLON),ISOTY(KLON)
INTEGER(KIND=JPIM) :: IMON(12)
INTEGER(KIND=JPIM) :: IYY,IMM,IDD,IINC,ISEC0,IYMD,IHM
INTEGER(KIND=JPIM) :: JK,JL,JTILE,JVT
REAL(KIND=JPRB) :: ZLAIVT(KLON,KVTYPES),ZCVT(KLON,KVTYPES)
INTEGER(KIND=JPIM) :: IVEG(KLON,KVTYPES)
LOGICAL LDEBUGPRINT

REAL(KIND=JPRB)  :: PALBICEF(KLON)
LOGICAL          :: LNEMOLIMALB
LOGICAL          :: LNEMOICETHK
REAL(KIND=JPRB)  :: ZTHKICE(KLON)

! Spectral emissivity
REAL(KIND=JPRB)  :: ZSPECTRALEMISS(KLON,NLWEMISS)
! Albedo coefficients
REAL(KIND=JPRB)  :: ZALCOEFF(KLON,6)

INTEGER(KIND=JPIM) :: JPDIAG=12
REAL(KIND=JPRB)  :: ZEXDIAG(KLON,12)

REAL(KIND=JPHOOK) :: ZHOOK_HANDLE


#include "surfbc.h"
#include "surfws.h"
#include "surfrad.h"
#include "surftstp.h"

#include "updcal.intfb.h"
#include "vdfmain1s.intfb.h"

#include "fcttim.h"

IF (LHOOK) CALL DR_HOOK('CALLPAR1S',0,ZHOOK_HANDLE)

!     ------------------------------------------------------------------

!*         1.     INITIAL COMPUTATIONS.
!                 ---------------------

!*       1.1   FIRST TIME-STEP
IF (KSTEP.EQ.KSTART) THEN
  PZ0M(KIDIA:KFDIA)=MAX(0.001_JPRB,PZ0MCL(KIDIA:KFDIA))
  PZ0H(KIDIA:KFDIA)=MAX(0.0001_JPRB,PZ0HCL(KIDIA:KFDIA))
ENDIF

!* Interpolate wind to correct height 
!IF(RALT.NE.RZUV) THEN
IF(RALT .NE. RZUV .AND. KSTEP .NE. KSTART ) THEN
  DO JL=KIDIA,KFDIA
    ZFAC=LOG(RALT/PZ0M(JL))/LOG(RZUV/PZ0M(JL))
    PU(JL,1:KLEV) = ZFAC*PU(JL,1:KLEV)
    PV(JL,1:KLEV) = ZFAC*PV(JL,1:KLEV)
    PU1(JL,1:KLEV) = ZFAC*PU1(JL,1:KLEV)
    PV1(JL,1:KLEV) = ZFAC*PV1(JL,1:KLEV)
  ENDDO
ENDIF

!* Initialize dummy AVGPAR array, fill with zero if no BVOC emissions
IF ( LBVOC_EMIS ) THEN   
      ZAVGPARC(KIDIA:KFDIA) = PAVGPAR(JL) ! W/m2
ELSE
      ZAVGPARC(KIDIA:KFDIA) = 0._JPRB
ENDIF


!*      1.2  TENDENCIES OF FORCINGS

ZTE(KIDIA:KFDIA,1:KLEV)=(PT1(KIDIA:KFDIA,1:KLEV)-PT(KIDIA:KFDIA,1:KLEV))/PTSPHY
ZQE(KIDIA:KFDIA,1:KLEV)=(PQ1(KIDIA:KFDIA,1:KLEV)-PQ(KIDIA:KFDIA,1:KLEV))/PTSPHY
ZVOM(KIDIA:KFDIA,1:KLEV)=(PU1(KIDIA:KFDIA,1:KLEV)-PU(KIDIA:KFDIA,1:KLEV))/PTSPHY
ZVOL(KIDIA:KFDIA,1:KLEV)=(PV1(KIDIA:KFDIA,1:KLEV)-PV(KIDIA:KFDIA,1:KLEV))/PTSPHY
IF(KTRAC .GT. 0 ) THEN
  ZTENC(KIDIA:KFDIA,1:KLEV,1:KTRAC)= &
    &   (PC1(KIDIA:KFDIA,1:KLEV,1:KTRAC)-PC(KIDIA:KFDIA,1:KLEV,1:KTRAC))/PTSPHY
ENDIF


ZCSN(KIDIA:KFDIA)=0.0_JPRB
!*      1.3a   AUXILLIARY VARIABLES FOR VDF, SRF AND RADSRF
CALL SURFBC(YDSURF, KIDIA,KFDIA,KLON,KTILES,KLEVSN &
     &           ,PSSDP2, PTVL   ,PCO2TYP,PTVH   ,PSOTY  ,PSDOR,PCVL   ,PCVH  ,PCUR &
     &           ,PLAILC ,PLAIHC, PLAILI, PLAIHI, PLAILC, PLAIHC,ZAVGPARC &     
     &           ,PLSM   ,PCI    ,PCIL, PCLAKE,PHLICE,PGEMU  ,PSNS, PWL,PRSN &  
     &           ,LESNICE &
     &           ,LLLAND ,LLSICE ,LLLICE,LLLAKE,LLNH, LLOCN_KPP &    
     &           ,ITVL   ,ICO2TYP, ITVH   ,ISOTY &
     &           ,ZCVL   ,ZCVH   ,ZCUR  , ZLAIL , ZLAIH, ZLAILP, ZLAIHP, ZAVGPAR & 
     &           ,ZWLMX  ,ZFRTI,ZCSN)



!*      1.3   GLOBAL AUXILLIARY VARIABLES
ZCHAR(KIDIA:KFDIA)=0.018_JPRB
ZCHARHQ(KIDIA:KFDIA)=0.006_JPRB


!*      1.3a   GLOBAL OCEAN TEMPORALY SET TO ZERO (to check with PJ)
PUSTOKES(KIDIA:KFDIA)=0.0_JPRB
PVSTOKES(KIDIA:KFDIA)=0.0_JPRB
PTAUOCX(KIDIA:KFDIA)=0.0_JPRB
PTAUOCY(KIDIA:KFDIA)=0.0_JPRB
PPHIOC(KIDIA:KFDIA)=0.0_JPRB
PWSEMEAN(KIDIA:KFDIA)=0.0_JPRB
PWSFMEAN(KIDIA:KFDIA)=0.0_JPRB

!*       1.4  SET SURFACE TENDENCIES TO ZERO
PTSAE1(KIDIA:KFDIA,1:KLEVS)=0.0_JPRB
PWSAE1(KIDIA:KFDIA,1:KLEVS)=0.0_JPRB
PTIAE1(KIDIA:KFDIA,1:KLEVS)=0.0_JPRB
PTLE1(KIDIA:KFDIA)=0.0_JPRB
PWLE1(KIDIA:KFDIA)=0.0_JPRB
PSNSE1(KIDIA:KFDIA,1:KLEVSN)=0.0_JPRB
PTSNE1(KIDIA:KFDIA,1:KLEVSN)=0.0_JPRB
PRSNE1(KIDIA:KFDIA,1:KLEVSN)=0.0_JPRB
PWSNE1(KIDIA:KFDIA,1:KLEVSN)=0.0_JPRB
PASNE1(KIDIA:KFDIA)=0.0_JPRB
ZUCURR(KIDIA:KFDIA)=0.0_JPRB
ZVCURR(KIDIA:KFDIA)=0.0_JPRB

!* FLAKE
PTLICEE1(KIDIA:KFDIA)=0.0_JPRB
PTLMNWE1(KIDIA:KFDIA)=0.0_JPRB
PTLWMLE1(KIDIA:KFDIA)=0.0_JPRB
PTLBOTE1(KIDIA:KFDIA)=0.0_JPRB
PTLSFE1(KIDIA:KFDIA)=0.0_JPRB
PHLICEE1(KIDIA:KFDIA)=0.0_JPRB
PHLMLE1(KIDIA:KFDIA)=0.0_JPRB
!* FLAKE 

PUOE1(KIDIA:KFDIA,1:KLEVO+1)=0.0_JPRB !KPP
PVOE1(KIDIA:KFDIA,1:KLEVO+1)=0.0_JPRB !KPP
PTOE1(KIDIA:KFDIA,1:KLEVO+1)=0.0_JPRB !KPP
PSOE1(KIDIA:KFDIA,1:KLEVO+1)=0.0_JPRB !KPP
PUOC(KIDIA:KFDIA,1:KLEVO+1)=0.0_JPRB  !KPP
PVOC(KIDIA:KFDIA,1:KLEVO+1)=0.0_JPRB  !KPP
PUSTRC(KIDIA:KFDIA)=0.0_JPRB          !KPP
PUOC(KIDIA:KFDIA,1:KLEVO+1)=0.0_JPRB  !KPP
PVOC(KIDIA:KFDIA,1:KLEVO+1)=0.0_JPRB  !KPP
PUSTRC(KIDIA:KFDIA)=0.0_JPRB          !KPP
PVSTRC(KIDIA:KFDIA)=0.0_JPRB          !KPP

!* CTESSEL
PLAIE1(KIDIA:KFDIA,1:KVTYPES)=0.0_JPRB
PBSTRE1(KIDIA:KFDIA,1:KVTYPES)=0.0_JPRB
PBSTR2E1(KIDIA:KFDIA,1:KVTYPES)=0.0_JPRB
!* CTESSEL

!     ------------------------------------------------------------------

!*         2.     RADIATION TRANSFER
!                 ------------------

!*         2.2 SURFACE BOUNDARY CONDITIONS
IF (LERADS) THEN
!* get time variables
    CALL DATTIM(ZJUL,IYMD,IHM)  
    IDD=NDD(IYMD)
    IMM=NMM(IYMD) 
    IYY=NCCAA(IYMD)
    IINC=0
    ISEC0=MOD(NSSSSS+NINT(RSTATI,KIND=JPIB),NINT(RDAY))   
    CALL UPDCAL  (IDD,IMM,IYY,IINC,IDD,IMM,IYY,IMON,-1_JPIM)  
    ZWND(KIDIA:KFDIA)=SQRT(PU(KIDIA:KFDIA,KLEV)**2+PV(KIDIA:KFDIA,KLEV)**2)
    ZWS1(KIDIA:KFDIA)=PWSA(KIDIA:KFDIA,1)
    LDEBUGPRINT=.FALSE.
    IF (LDEBUGPRINT) THEN
      PRINT *,"DEBUG SURFRAD -->"
      PRINT *,"NSW",NSW
      PRINT *,"LLNH",LLNH
      PRINT *,"PALBF",PALBF
      PRINT *,"PASN",PASN
      PRINT *,"PMU0M",PMU0M
      PRINT *,"PTL",PTL
      PRINT *,"ZWND",ZWND
      PRINT *,"ZWS1",ZWS1
      PRINT *,"ZFRTI",ZFRTI
      PRINT *,"ZALBD(:,1:NSW)",ZALBD(:,1:NSW)
      PRINT *,"ZALBP(:,1:NSW)",ZALBP(:,1:NSW)
      PRINT *,"PALB",PALB
      PRINT *,"ZEMIR",ZEMIR
      PRINT *,"ZEMIW",ZEMIW
      PRINT *,"ZEMIS",ZEMIS
      PRINT *,"ZALBTI",ZALBTI
      PRINT *,"ZCCNL",ZCCNL
      PRINT *,"ZCCNO",ZCCNO
    ENDIF
    LNEMOLIMALB=.FALSE.
    PALBICEF(:) = -999._JPRB
    
    IF (NALBEDOSCHEME == 2) THEN
      ! 6 components
      ZALCOEFF(KIDIA:KFDIA,1) = PALUVI(KIDIA:KFDIA)
      ZALCOEFF(KIDIA:KFDIA,2) = PALUVV(KIDIA:KFDIA)
      ZALCOEFF(KIDIA:KFDIA,3) = PALUVG(KIDIA:KFDIA)
      ZALCOEFF(KIDIA:KFDIA,4) = PALNII(KIDIA:KFDIA)
      ZALCOEFF(KIDIA:KFDIA,5) = PALNIV(KIDIA:KFDIA)
      ZALCOEFF(KIDIA:KFDIA,6) = PALNIG(KIDIA:KFDIA)
    ELSE
      ! 4 components
      ZALCOEFF(KIDIA:KFDIA,1) = PALUVP(KIDIA:KFDIA)
      ZALCOEFF(KIDIA:KFDIA,2) = PALUVD(KIDIA:KFDIA)
      ZALCOEFF(KIDIA:KFDIA,3) = PALNIP(KIDIA:KFDIA)
      ZALCOEFF(KIDIA:KFDIA,4) = PALNID(KIDIA:KFDIA)
    ENDIF

    CALL SURFRAD ( YDSURF, KDD=IDD, KMM=IMM, KMON=IMON  , KSECO=ISEC0 &
     &     , KIDIA=KIDIA  , KFDIA=KFDIA  , KLON=KLON   , KTILES=KTILES , KSW=NSW, KLW=NLWEMISS &
     &     , LDNH=LLNH,LDLAND=LLLAND &
     &     , PSSDP3=PSSDP3 &
     &     , PALBF=PALBF ,PALBICEF=PALBICEF,PTVH=PTVH &
     &     , PALCOEFF=ZALCOEFF ,PCUR=PCUR, PCVH=PCVH &
     &     , PASN=PASN   , PMU0=PMU0M  , PTS=PTL    , PWND=ZWND &
     &     , PWS1=ZWS1, KSOTY=ISOTY, PFRTI=ZFRTI,PHLICE=PHLICE,PTLICE=PTLICE &
     &     , PALBD=ZALBD(:,1:NSW)  , PALBP=ZALBP(:,1:NSW)  , PALB=PALB &
     &     , PSPECTRALEMISS=ZSPECTRALEMISS , PEMIT=ZEMIS &
     &     , PALBTI=ZALBTI, PCCNL=ZCCNL, PCCNO=ZCCNO &
     &     , LNEMOLIMALB=LNEMOLIMALB&
     &     , LESNICE=LESNICE)
    ZEMIR(KIDIA:KFDIA) = ZSPECTRALEMISS(KIDIA:KFDIA,1)
    ZEMIW(KIDIA:KFDIA) = ZSPECTRALEMISS(KIDIA:KFDIA,2)

!      PRINT *,"PMU0M",PMU0M
    IF (LDEBUGPRINT) THEN
      PRINT *,"DEBUG SURFRAD <--"
      PRINT *,"NSW",NSW
      PRINT *,"LLNH",LLNH
      PRINT *,"PALBF",PALBF
      PRINT *,"PASN",PASN
      PRINT *,"PMU0M",PMU0M
      PRINT *,"PTL",PTL
      PRINT *,"ZWND",ZWND
      PRINT *,"ZWS1",ZWS1
      PRINT *,"ZFRTI",ZFRTI
      PRINT *,"ZALBD(:,1:NSW)",ZALBD(:,1:NSW)
      PRINT *,"ZALBP(:,1:NSW)",ZALBP(:,1:NSW)
      PRINT *,"PALB",PALB
      PRINT *,"ZEMIR",ZEMIR
      PRINT *,"ZEMIW",ZEMIW
      PRINT *,"ZEMIS",ZEMIS
      PRINT *,"ZALBTI",ZALBTI
      PRINT *,"ZCCNL",ZCCNL
      PRINT *,"ZCCNO",ZCCNO
    ENDIF
ELSE
  DO JK=1,KTILES
    ZALBTI(KIDIA:KFDIA,JK)=PALBF(KIDIA:KFDIA)
  ENDDO
  PALB(KIDIA:KFDIA)=PALBF(KIDIA:KFDIA)
  ZEMIS(KIDIA:KFDIA)=REMISS
  ZEMIR(KIDIA:KFDIA)=REMISS
  ZEMIW(KIDIA:KFDIA)=REMISS
ENDIF
IF (LSEMISS) ZEMIS(KIDIA:KFDIA)=REMISS
PFRSO(KIDIA:KFDIA,KLEV)=PSRSOD(KIDIA:KFDIA)*(1._JPRB-PALB(KIDIA:KFDIA))
PFRTH(KIDIA:KFDIA,KLEV)=ZEMIS(KIDIA:KFDIA)* &
     &       (PSRTHD(KIDIA:KFDIA)-RSIGMA*PTL(KIDIA:KFDIA)**4)

!*      1.3b 

IF ( (KSTEP==KSTART) .AND. (LEWARMSTART) )  THEN
  CALL SURFWS(YDSURF, KIDIA, KFDIA, KLON, KLEVS, KLEVSN, KTILES  &
             ,PSDOR,LLSICE                                       &
             ,PLSM,PCIL, ZFRTI, PMU0M                                 &
             ,PTSA, PTL,PASN                                     &
             ,PTSN, PSNS, PRSN, PWSN                           )
ENDIF
         

!     ------------------------------------------------------------------

!*         3.     VERTICAL EXCHANGE OF U,V,T,Q BY TURBULENCE
!                 ------------------------------------------

IF ( LEVDIF ) THEN

IF (LDEBUGPRINT) THEN
   PRINT *, "DEBUG IN VDFMAIN1S:"
   PRINT *, "------------------>"
   PRINT *,'CDCONF',CDCONF
   PRINT *,'KIDIA',KIDIA
   PRINT *,'KFDIA',KFDIA
   PRINT *,'KLON',KLON
   PRINT *,'KLEV',KLEV
   PRINT *,'KLEVS',KLEVS
   PRINT *,'KSTEP',KSTEP
   PRINT *,'KTILES',KTILES
   PRINT *,'KTRAC',KTRAC
   PRINT *,'KLEVSN',KLEVSN 
   PRINT *,'KLEVI',KLEVI  
   PRINT *,'KDHVTLS',KDHVTLS
   PRINT *,'KDHFTLS',KDHFTLS
   PRINT *,'KDHVTSS',KDHVTSS
   PRINT *,'KDHFTSS',KDHFTSS
   PRINT *,'KDHVTTS',KDHVTTS
   PRINT *,'KDHFTTS',KDHFTTS
   PRINT *,'KDHVTIS',KDHVTIS
   PRINT *,'KDHFTIS',KDHFTIS
   PRINT *,'PTSPHY',PTSPHY
   PRINT *,'ITVL',ITVL
   PRINT *,'ICO2TYP',ICO2TYP
   PRINT *,'ITVH',ITVH
   PRINT *,'ISOTY',ISOTY
   PRINT *,'ZCVL',ZCVL
   PRINT *,'ZCVH',ZCVH
   PRINT *,'ZCUR',ZCUR
   PRINT *,'ZCIL',PCIL
   PRINT *,'ZLAIL',ZLAIL
   PRINT *,'ZLAIH',ZLAIH
   PRINT *,'ZLAILP',ZLAILP
   PRINT *,'ZLAIHP',ZLAIHP
   PRINT *,'ZAVGPAR',ZAVGPAR
   PRINT *,'PU',PU  
   PRINT *,'PV',PV  
   PRINT *,'PT',PT  
   PRINT *,'PQ',PQ  
   PRINT *,'PC',PC  
   PRINT *,'PAPRS',PAPRS
   PRINT *,'PGEOM1',PGEOM1
   PRINT *,'PTL',PTL
   PRINT *,'PTSA',PTSA
   PRINT *,'PWSA',PWSA
   PRINT *,'PFRSO(1,KLEV)',PFRSO(1,KLEV)
   PRINT *,'PFRTH(1,KLEV)',PFRTH(1,KLEV)
   PRINT *,'ZEMIS',ZEMIS
   PRINT *,'PTSN',PTSN
   PRINT *,'PTIA',PTIA
   PRINT *,'PSST',PSST  
   PRINT *,'ZFRTI',ZFRTI 
   PRINT *,'ZALBTI',ZALBTI
   PRINT *,'ZWLMX',ZWLMX
   PRINT *,'ZCHAR',ZCHAR 
   PRINT *,'ZCHARHQ',ZCHARHQ 
   PRINT *,'PTL',PTL
! skin temp at latest rad timestep
   PRINT *,'PCFLX',PCFLX
   PRINT *,'PZ0M',PZ0M
   PRINT *,'PZ0H',PZ0H
   PRINT *,'PVDIS',PVDIS 
   PRINT *,'PFTLHEV',PFTLHEV
   PRINT *,'PFTLHSB',PFTLHSB
   PRINT *,'PFWSB',PFWSB
   PRINT *,'PU10M',PU10M 
   PRINT *,'PV10M',PV10M 
   PRINT *,'PT2M',PT2M  
   PRINT *,'PD2M',PD2M 
   PRINT *,'PQ2M',PQ2M 
   PRINT *,'PBLH',PBLH 
   PRINT *,'ZFRSOTI',ZFRSOTI
   PRINT *,'ZEVAPSNW',ZEVAPSNW
   PRINT *,'PGUST',PGUST
   PRINT *,'PZIDLWV',PZIDLWV
!-UPDATED TENDENCIES
   PRINT *,'ZTE',ZTE   
   PRINT *,'ZQE',ZQE   
   PRINT *,'ZVOM',ZVOM  
   PRINT *,'ZVOL',ZVOL  
   PRINT *,'ZTENC',ZTENC 
   PRINT *,'PTLE1',PTLE1
!-UPDATED FIELDS FOR TILES
   PRINT *,'PUSTRTI',PUSTRTI
   PRINT *,'PVSTRTI',PVSTRTI
   PRINT *,'PAHFSTI',PAHFSTI
   PRINT *,'PEVAPTI',PEVAPTI
   PRINT *,'PTSKTI',PTSKTI
!-OUTPUT FLUXES
   PRINT *,'PDIFTS',PDIFTS
   PRINT *,'PDIFTQ',PDIFTQ
   PRINT *,'PSTRTU',PSTRTU
   PRINT *,'PSTRTV',PSTRTV
!    PRINT *,'ZKH',ZKH
 ! DDH OUTPUTS
   PRINT *,'PDHTLS',PDHTLS
   PRINT *,'PDHTSS',PDHTSS
   PRINT *,'PDHTTS',PDHTTS
   PRINT *,'PDHTIS',PDHTIS
ENDIF

!   Create space for diagnostic array (for possible pp of canopy resitances)
!   Put LAT/LON in field 1 an 2, just in case that it is needed in SURF for debugging.  
ZEXDIAG(KIDIA:KFDIA,11)=GELAT(KIDIA:KFDIA) ! Latitude
ZEXDIAG(KIDIA:KFDIA,12)=GELAM(KIDIA:KFDIA) ! Longitude

  CALL VDFMAIN1S ( CDCONF,&
 & KIDIA,KFDIA,KLON,KLEV,KLEVS,KSTEP,KTILES, KVTYPES,JPDIAG,&
 & KTRAC,KLEVSN ,KLEVI  ,LLLAND, KDHVTLS,KDHFTLS,KDHVTSS,KDHFTSS, &
 & KDHVTTS,KDHFTTS,KDHVTIS,KDHFTIS, &
 & KDHVCO2S,KDHFCO2S, KDHVBVOCS, KDHVVEGS,KDHFVEGS,  &
 & LESNICE,&
 & PMU0M   , &
 & PTSPHY,ITVL,ICO2TYP,ITVH,ZCVL,ZCVH,PCUR,PFWET,PLAT,ZLAIL,ZLAIH,&
 & ZLAILP, ZLAIHP, ZAVGPAR,PISOP_EP, &
 & PCIL, &
 & PSNS,PRSN, &
 & PU  ,PV  ,PT  ,PQ  ,PC  ,&
 & PAPRS,PGEOM1,&
 & PTL,PTSA,PWSA,&
 & PFRSO(1,KLEV),PFRTH(1,KLEV),ZEMIS,&
 & PTSN, PTIA,&
 & PHLICE,PTLICE,PTLWML, &                             !FLAKE
 & PSST  ,ISOTY, ZFRTI , ZALBTI,ZWLMX,&
 & ZCHAR , ZCHARHQ, ZUCURR , ZVCURR,&
 & PTL,&                         ! skin temp at latest rad timestep
 & PCFLX,&
 & PSSDP2, PSSDP3,&
 !-OUTPUT
 & PZ0M ,PZ0H ,&
 & PVDIS , PFTLHEV,&
 & PFTLHSB,&
 & PFWSB,&
 & PU10M ,PV10M ,PT2M  ,PD2M ,PQ2M ,PBLH ,ZFRSOTI,ZEVAPSNW,&
 & ZEXDIAG,PGUST, PZIDLWV,&
 !-UPDATED TENDENCIES
 & ZTE   ,ZQE   ,ZVOM  ,ZVOL  ,ZTENC ,PTLE1,&
 !-UPDATED FIELDS FOR TILES
 & PUSTRTI,PVSTRTI,PAHFSTI,PEVAPTI,PTSKTI,PSLRFLTI,&
 !-UPDATED FIELDS FOR VEGETATION TYPES
 & PANDAYVT,PANFMVT,& 
 !-OUTPUT FLUXES
 & PEVAPTIU,PDIFTS,PDIFTQ,PSTRTU,PSTRTV,ZKH,&
 & PAN,PAG,PRD,PRSOIL_STR,PRECO,PCO2FLUX,PCH4FLUX,& 
 & PBVOCFLUX, &
 ! DDH OUTPUTS
 & PDHTLS,PDHTSS,PDHTTS,PDHTIS,PDHCO2S,PDHBVOCS,PDHVEGS)


  
IF (LDEBUGPRINT) THEN
   PRINT *, "DEBUG IN VDFMAIN1S:"
   PRINT *, "<------------------"
   PRINT *,'CDCONF',CDCONF
   PRINT *,'KIDIA',KIDIA
   PRINT *,'KFDIA',KFDIA
   PRINT *,'KLON',KLON
   PRINT *,'KLEV',KLEV
   PRINT *,'KLEVS',KLEVS
   PRINT *,'KSTEP',KSTEP
   PRINT *,'KTILES',KTILES
   PRINT *,'KTRAC',KTRAC
   PRINT *,'KLEVSN',KLEVSN 
   PRINT *,'KLEVI',KLEVI  
   PRINT *,'KDHVTLS',KDHVTLS
   PRINT *,'KDHFTLS',KDHFTLS
   PRINT *,'KDHVTSS',KDHVTSS
   PRINT *,'KDHFTSS',KDHFTSS
   PRINT *,'KDHVTTS',KDHVTTS
   PRINT *,'KDHFTTS',KDHFTTS
   PRINT *,'KDHVTIS',KDHVTIS
   PRINT *,'KDHFTIS',KDHFTIS
   PRINT *,'PTSPHY',PTSPHY
   PRINT *,'ITVL',ITVL
   PRINT *,'ICO2TYP',ICO2TYP
   PRINT *,'ITVH',ITVH
   PRINT *,'ZCVL',ZCVL
   PRINT *,'ZCVH',ZCVH
   PRINT *,'ZCUR',ZCUR
   PRINT *,'ZLAIL',ZLAIL
   PRINT *,'ZLAIH',ZLAIH
   PRINT *,'PU',PU  
   PRINT *,'PV',PV  
   PRINT *,'PT',PT  
   PRINT *,'PQ',PQ  
   PRINT *,'PC',PC  
   PRINT *,'PAPRS',PAPRS
   PRINT *,'PGEOM1',PGEOM1
   PRINT *,'PTL',PTL
   PRINT *,'PTSA',PTSA
   PRINT *,'PWSA',PWSA
   PRINT *,'PFRSO(1,KLEV)',PFRSO(1,KLEV)
   PRINT *,'PFRTH(1,KLEV)',PFRTH(1,KLEV)
   PRINT *,'ZEMIS',ZEMIS
   PRINT *,'PTSN',PTSN
   PRINT *,'PTIA',PTIA
   PRINT *,'PSST',PSST  
   PRINT *,'ZFRTI',ZFRTI 
   PRINT *,'ZALBTI',ZALBTI
   PRINT *,'ZWLMX',ZWLMX
   PRINT *,'ZCHAR',ZCHAR 
   PRINT *,'ZCHARHQ',ZCHARHQ 
   PRINT *,'PTL',PTL
! skin temp at latest rad timestep
   PRINT *,'PCFLX',PCFLX
   PRINT *,'PZ0M',PZ0M
   PRINT *,'PZ0H',PZ0H
   PRINT *,'PVDIS',PVDIS 
   PRINT *,'PFTLHEV',PFTLHEV
   PRINT *,'PFTLHSB',PFTLHSB
   PRINT *,'PFWSB',PFWSB
   PRINT *,'PU10M',PU10M 
   PRINT *,'PV10M',PV10M 
   PRINT *,'PT2M',PT2M  
   PRINT *,'PD2M',PD2M 
   PRINT *,'PQ2M',PQ2M 
   PRINT *,'PBLH',PBLH 
   PRINT *,'ZFRSOTI',ZFRSOTI
   PRINT *,'ZEVAPSNW',ZEVAPSNW
   PRINT *,'PGUST',PGUST
   PRINT *,'PZIDLWV',PZIDLWV
!-UPDATED TENDENCIES
   PRINT *,'ZTE',ZTE   
   PRINT *,'ZQE',ZQE   
   PRINT *,'ZVOM',ZVOM  
   PRINT *,'ZVOL',ZVOL  
   PRINT *,'ZTENC',ZTENC 
   PRINT *,'PTLE1',PTLE1
!-UPDATED FIELDS FOR TILES
   PRINT *,'PUSTRTI',PUSTRTI
   PRINT *,'PVSTRTI',PVSTRTI
   PRINT *,'PAHFSTI',PAHFSTI
   PRINT *,'PEVAPTI',PEVAPTI
   PRINT *,'PTSKTI',PTSKTI
!-OUTPUT FLUXES
   PRINT *,'PDIFTS',PDIFTS
   PRINT *,'PDIFTQ',PDIFTQ
   PRINT *,'PSTRTU',PSTRTU
   PRINT *,'PSTRTV',PSTRTV
   PRINT *,'ZKH',ZKH
 ! DDH OUTPUTS
   PRINT *,'PDHTLS',PDHTLS
   PRINT *,'PDHTSS',PDHTSS
   PRINT *,'PDHTTS',PDHTTS
   PRINT *,'PDHTIS',PDHTIS
  STOP
ENDIF

ELSE

!*         3.1     NECESSARY COMPUTATIONS IF SUBROUTINE IS BY-PASSED.      

  PVDIS(KIDIA:KFDIA)=0._JPRB
  PFTLHEV(KIDIA:KFDIA)=0._JPRB
  PFTLHSB(KIDIA:KFDIA)=0._JPRB
  PFWSB(KIDIA:KFDIA)=0._JPRB
  ZEVAPSNW(KIDIA:KFDIA)=0._JPRB
  PDIFTQ(KIDIA:KFDIA,1:KLEVS)=0._JPRB
  PDIFTS(KIDIA:KFDIA,1:KLEVS)=0._JPRB
  PSTRTU(KIDIA:KFDIA,1:KLEVS)=0._JPRB
  PSTRTV(KIDIA:KFDIA,1:KLEVS)=0._JPRB
  DO JTILE=1,KTILES
    ZFRSOTI(KIDIA:KFDIA,JTILE)=PFRSO(KIDIA:KFDIA,KLEV)
    PUSTRTI(KIDIA:KFDIA,JTILE)=0._JPRB
    PVSTRTI(KIDIA:KFDIA,JTILE)=0._JPRB
    PAHFSTI(KIDIA:KFDIA,JTILE)=0._JPRB
    PEVAPTI(KIDIA:KFDIA,JTILE)=0._JPRB
    PTSKTI(KIDIA:KFDIA,JTILE)=PTL(KIDIA:KFDIA)
  ENDDO
ENDIF
!     ------------------------------------------------------------------

!*         4.      COMPUTATION OF NEW SURFACE VALUES
!                  ---------------------------------

ZPAPSRF(KIDIA:KFDIA)=PAPRS(KIDIA:KFDIA,KLEV)
IF ( LESURF ) THEN
!*         4.1   CALL SURFTSTP
  ZFRTH(KIDIA:KFDIA)=PFRTH(KIDIA:KFDIA,KLEV)  
  ZTHKICE(KIDIA:KFDIA)=1.5_JPRB
  LNEMOICETHK=.FALSE.
!-END OF CALL SURFTSTP
  CALL SURFTSTP( YDSURF, KIDIA   , KFDIA , KLON  , KLEVS,NCWS, KTILES,&
     & KLEVSN , KLEVO , KLEVI   ,  KSTART, KSTEP,&
     & KDHVTSS , KDHFTSS,&
     & KDHVTTS , KDHFTTS,& 
     & KDHVTIS , KDHFTIS,&
     & KDHVSSS , KDHFSSS,&
     & KDHVIIS , KDHFIIS,& 
     & KDHVWLS , KDHFWLS,&
     & KDHVBIOS, KDHFBIOS, KDHVVEGS, KDHFVEGS, &              !CTESSEL
     & ITVL  , ITVH, IVEG, ISOTY, &
     & PSSDP2, PSSDP3, &
     & PTSPHY , PSDOR , ZFRTI,&
     & PSST, PUSTRTI, PVSTRTI,&
     & PAHFSTI, PEVAPTI, ZFRSOTI, PSLRFLTI,&
     & GELAT, PANFMVT, PANDAYVT, PMU0M,&                      !CTESSEL
     & ZCVT, ZLAIVT, ZLAIL, ZLAIH, &                          !CTESSEL
     & PCIL, &
     & PLAILC,  PLAIHC, &
     & LLLAND, LLSICE,LLLICE, LESICE, LLNH, LLOCN_KPP,&              !KPP
     & PSNS  ,PTSN,PASN,PRSN,PWSN,ZPAPSRF,PTL,PTSA,PTIA,&
     & PWL  ,PWSA,&
     & PTLICE,PTLMNW,PTLWML,PTLBOT,PTLSF, &                   !FLAKE
     & PHLICE,PHLML,PGEMU,PLDEPTH,LLLAKE,PCLAKE, &            !FLAKE
     & PFPLCL  , PFPLSL,&
     & ZFRTH   , PFPLCN  , PFPLSN,&
     & ZCVL    , ZCVH    , PCUR, ZWLMX   , ZEVAPSNW,&
     & PU(:,KLEV),PV(:,KLEV),PT(:,KLEV),&
!-KPP
     & PZO      ,PHO      ,PHO_INV  ,PDO      ,POCDEPTH  ,&   !KPP
     & PUO0     ,PVO0     ,PUOC     ,PVOC     ,PTO0      ,&   !KPP
     & PSO0     ,PADVT    ,PADVS    ,PTRI0    ,PTRI1     ,&   !KPP
     & PSWDK_SAVE,PUSTRC  ,PVSTRC                        ,&   !KPP
     & PUSTOKES ,PVSTOKES ,PTAUOCX  ,PTAUOCY  ,PPHIOC    ,& ! Ocean TKE
     & PWSEMEAN ,PWSFMEAN ,                               & ! Ocean TKE
     & LNEMOICETHK, ZTHKICE, &
!-DIAGNOSTICS OUTPUT
     & PFTG12  , PFWROD , PFWRO1 ,& 
     & PFWG12  , PFWMLT , PFWEV  , ZENES,&
     & PDIFM   , PDIFT  , PDIFS  , POTKE,&                    !KPP/TKE
     & PRESPBSTR,PRESPBSTR2,PBIOMASS_LAST,PBIOMASSTR_LAST,PBIOMASSTR2_LAST, & !CTESSEL
     & PBLOSSVT, PBGAINVT, &                                                  !CTESSEL
     & PLAI, PBIOM, PBLOSS, PBGAIN, PBIOMSTR, PBIOMSTR2, &                    !CTESSEL 
!-TENDENCIES OUTPUT
     & PSNSE1  , PTSNE1 , PASNE1,&
     & PRSNE1  , PWSNE1 , PTSAE1 , PTIAE1,&
     & PWLE1   , PWSAE1,&
     & PTLICEE1,PTLMNWE1,PTLWMLE1,&                           !FLAKE
     & PTLBOTE1,PTLSFE1,PHLICEE1,PHLMLE1,&                    !FLAKE
     & PUOE1   ,PVOE1    ,PTOE1  ,PSOE1   ,&                  !KPP
     & PLAIE1, PBSTRE1, PBSTR2E1, &                           !CTESSEL
!-DDH OUTPUTS
     & PDHTSS  , PDHTTS , PDHTIS,&
     & PDHSSS  , PDHIIS , PDHWLS,&
     & PDHBIOS,PDHVEGS)                                        !CTESSEL 
!-END OF CALL SURFTSTP

!write(6,*) 'callpar1s pdhwls(1,4,8)',pdhwls(1,4,8)
ELSE

!*         4.2     NECESSARY COMPUTATIONS IF SUBROUTINE IS BY-PASSED.
  PFTG12(KIDIA:KFDIA)=0._JPRB
  PFWROD(KIDIA:KFDIA)=0._JPRB
  PFWRO1(KIDIA:KFDIA)=0._JPRB
  PFWMLT(KIDIA:KFDIA)=0._JPRB
  PFWG12(KIDIA:KFDIA)=0._JPRB
  PFWEV(KIDIA:KFDIA)=0._JPRB
ENDIF

!*              5.     END OF E.C.M.W.F. PHYSICS
!                      -------------------------

IF (LHOOK) CALL DR_HOOK('CALLPAR1S',1,ZHOOK_HANDLE)

RETURN
END SUBROUTINE CALLPAR1S



















